\documentclass{ctexart}
\usepackage{graphicx} %插入图片的宏包
\usepackage{diagbox}
\usepackage{float} %设置图片浮动位置的宏包
\usepackage{subfigure}
\usepackage{amsmath}
\title{Numerical Analysis Ex4}
\date{20-11-2022}
\author{王惠恒 3200300395}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={170mm,257mm},
 left=20mm,
 top=5mm,
 }
\begin{document}
\maketitle
\textbf{I}:ANS:$1.11011101 \times 2^8$\\

\textbf{II}:ANS:$0.100\dot{1}=1.0011001... \times 2^{-1}$\\

\textbf{III}:Let $x$ be a normalized form and its mantissa has $p$ precisions.
\begin{align*}
    x&=1.000...0 \times \beta^e\\
    x_R&=1.000...1 \times \beta^e\\
    x_L&=0.(\beta-1)(\beta-1)(\beta-1)...(\beta-1) \times \beta^e\\
    &=(\beta-1).(\beta-1)(\beta-1)(\beta-1)...(\beta-1) \times \beta^{e-1}\\
    x_R-x&=0.000...1 \times \beta^e\\
    x-x_L&=0.000...1 \times \beta^{e-1}\\
    \Rightarrow x_R-x&=\beta(x-x_L)
\end{align*}

\textbf{IV}:Single precision protocol: $\beta=2,p=23+1,e \in [-126,127]$
\begin{align*}
    x&=1.0011001... \times 2^{-1}\\
    x_R&=1.001001001001001001001010 \times 2^{-1}\\
    x_L&=1.001001001001001001001001 \times 2^{-1}\\
    x-x_L&=\frac{3}{5} \times 2^{-24}\\
    x_R-x_L&=1 \times 2^{-24}\\
    x_R-x&=(x_R-x_L)-(x-x_L)=\frac{2}{5} \times 2^{-24}
\end{align*}
ANS:$ fl(x)=x_R=1.001001001001001001001010 \times 2^{-1}$,relative roundoff error is $\frac{|x_R-x|}{|x|}=\frac{2}{3}\times 2^{-24}$\\

\textbf{V}: $|fl(x)-x| \leq |x_R-x_L|$,thus $\epsilon_u=(1-2^{-23})(2^{-23})$\\

\textbf{VI}:$1-cos(\frac{1}{4})=0.03108=1.11 \times 2^{-6}$,by Theorem 4.49,we have
$$2^{-6}<1-cos(\frac{1}{4})<2^{-5}$$
thus, it may lose 5 or 6 bits of precision.\\

\textbf{VII}:The first way is Taylor's expansion:
\begin{align*}
    1-\cos{x}&=1-(1-\frac{x^2}{2!}+\frac{x^4}{4!}+...)\\
    &=\frac{x^2}{2!}-\frac{x^4}{4!}+...
\end{align*}
The second way is from the property:
$$1-\cos{x}=2sin^2(\frac{x}{2})$$

\textbf{VIII}:By $C_f(x)=|\frac{xf'(x)}{f(x)}|$\\
(a)$C_f(x)=|\frac{x \alpha}{x-1}|$, it is large when $x \rightarrow 1$\\
(b)$C_f(x)=|\frac{1}{lnx}|$,it is large when $x \rightarrow 0^+$\\
(c)$C_f(x)=|x|$,it is large when $x \rightarrow \pm \infty$\\
(d)$C_f(x)=|\frac{-x}{\sqrt{1-x^2}\arccos{x}}|$,it is large when $x \rightarrow \pm 1$\\

\textbf{IX}:By $C_f(x)=|\frac{xf'(x)}{f(x)}|$\\
(a)$C_f(x)=|\frac{xe^{-x}}{1-e^{-x}}|$,$(\frac{xe^{-x}}{1-e^{-x}})'=\frac{-xe^{-x}+e^{-x}-e^{-2x}}{(1-e^{-x})^2}=0 \Rightarrow 1-x=e^{-x}$,thus $C_f(x)=|1-x| \leq 1, \forall x \in [0,1]$
(b)For $|\delta_1|,|\delta_2|<\epsilon_u$
\begin{align*}
    f_A(x)&=(1-e^{-x}(1+\delta_1))(1+\delta_2)\\
    &=(1+e^{-x})(1+\delta_2+\frac{e^{-x}\delta_1(1+\delta_2)}{1+e^{-x}})\\
    \delta(x)&=\delta_2+\frac{e^{-x}\delta_1(1+\delta_2)}{1+e^{-x}}\\
    |\delta(x)| &\leq \frac{\epsilon_u e^x+\epsilon_u^2}{e^x-1}\\
    &\leq \epsilon_u(\frac{e^x+1}{e^x-1})
\end{align*}
By Theorem 4.76, \begin{align*}
    cond_A & \leq \frac{\varphi(x)}{cond_f(x)}\\
    |cond_A(x)|& \leq |\frac{\frac{e^x+1}{e^x-1}}{\frac{xe^{-x}}{1-e^{-x}}}|\\
    & \leq |\frac{e^x+1}{x}| 
\end{align*}
where $cond_A(x)$ is large when $x \rightarrow 0$.\\
(c)
\begin{figure}[H]
\includegraphics[width=0.5\textwidth]{IX.jpeg}
\end{figure}
From the graph shown above, we can observe that $C_f(x)$ is bounded due to the continuity on $[0,1]$.However,when $x \rightarrow 0,C_A(x) \rightarrow \infty$,which means that it is not stable in the neighbourhood of $x=0$.\\

\textbf{X}:Given that the $$q(x)=\sum_{i=0}^{n}a_ix^i,a_n=1,a_0,a_i \in R$$a
and by Definition 4.65 ,we have $$cond_f(x)=||(\frac{a_0}{r}\frac{\partial r}{\partial a_0},...,\frac{a_{n-1}}{r}\frac{\partial r}{\partial a_{n-1}})^T||_1=\sum_{k=1}^{n-1}|\frac{a_k}{r}\frac{\partial r}{\partial a_k}|$$.
Assume that $r$ is the root,$r=f(a_0,...,a_{n-1})$,and differentiate with respect to $a_k$,
\begin{align*}
    \sum_{i=0}^{n}a_ir^i&=0\\
    a_0+a_1r+...+a_kr^k+...a_{n-1}r^{n-1}+r^n&=0\\
    a_1 \frac{\partial r}{a_k}+2a_2r\frac{\partial r}{a_k}+...+a_k(kr^{k-1}\frac{\partial r}{a_k})+r^k+...+(n-1)a_{n-1}r^{n-2}\frac{\partial r}{a_k})+nr^{n-1}\frac{\partial r}{a_k}&=0\\
    r^k+\frac{\partial r}{a_k}(a_1+2a_2r+...+ka_kr^{k-1}+...+(n-1)a_{n-1}r^{n-2}+na_nr^{n-1})&=0\\
    r^k+\frac{\partial r}{a_k}\sum_{i=1}^{n-1}ia_ir^{i-1}&=0\\
    r^k+\frac{\partial r}{a_k}q'(r)&=0\\
    \frac{\partial r}{a_k}&=-\frac{r^k}{q'(r)}\\
\end{align*}
and then substitute it to the $cond_f(x)$,we can get
\begin{align*}
    cond_f(x)&=\sum_{k=0}^{n-1}|\frac{a_k}{r}(-\frac{r^k}{q'(r)})|\\
    &=\sum_{k=0}^{n-1}|\frac{a_kr^k}{rq'(r)}|\\
    &=|\frac{q(r)-r^n}{rq'(r)}|,q(r)=0\\
    &=|\frac{r^{n-1}}{q'(r)}|
\end{align*}
By Wilkinson example,
$$p(x)=\prod_{k=1}^{n}(x-k)$$
it is a polynomial in the form which is set as $q(x)$,so their condition number is in the same form.If we take $r=n$, then the condition number is $\frac{n^{n-1}}{(n-1)!} \rightarrow \infty(n \rightarrow \infty)$,which means that it is not stable when $r=n,n \rightarrow \infty$.\\

\textbf{XI}:Example FPN system:(2,2,-1,1),$a=1.0 \times 2^0,b=1.1 \times 2^0,\frac{a}{b}=\frac{2}{3}=(0.101010...)_2$.If the precision $2p=4$,then $E_{rel}=|\frac{fl(\frac{a}{b})-\frac{a}{b}}{\frac{a}{b}}|=(0.01)_2=2 \epsilon_M=\epsilon_u$.However,$fl(\frac{a}{b})=\frac{a}{b}(1+\delta)\rightarrow |\delta|=\frac{1}{4}=(0.01)_2=\epsilon_u$.Then it contradicts Theorem 4.39.\\

\textbf{XII}:$128=10000000=1 \times 2^7,129=10000001=1.0000001 \times 2^7$.$\forall x_1,x_2 \in [128,129],|x_1-x_2|<=2^7\epsilon_M=2^7 \cdot 2^{1-24}=2^{-16} \approx 1.525 \times 10^{-5}>10^{-6}$.Therefore,we are not able to compute the root with absolute accuracy $< 10^{-6}$.\\

\textbf{XIII}:$cond_f(x)=||A(x)||$,where $A(x)=[a_{ij}(x)]$ and $a_{ij}(x)=|\frac{x_j\frac{\partial f_i}{\partial x_j}}{f_i(x)}|$.We can firstly find the eigenvalue of the condition number and then determine whether all of them are less than 1(bounded by 1).If it is true ,then the statement will not exist.Else,the statement is true.

\end{document}